<?php
/* @var $this RealEstateController */
/* @var $model RealEstate */



?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'real-estate-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
        'ajaxUrl'=>Yii::app()->createUrl("realEstate/admin"),
        //'showTableOnEmpty'=>FALSE,
        'itemsCssClass' => 'table table-hover',
	'columns'=>array(
		array(
            'name' => 'img1',
            'type' => 'image',
            'value' => '"/uploads/$data->img1"',
            'htmlOptions'=>array('class'=>'imgresult img-polaroid')
           
        ),
		
            array(
                'name'=>'title',
                'value'=>'Yii::t("content","$data->title",array(),"db_i18n")'
            ),
		array(
                'name'=>'description',
                'value'=>'Yii::t("content","$data->description",array(),"db_i18n")'
            ),
		'lat',
		'long',
		'square_meters',
            array(
                'name' => 'activ',
                'type' => 'raw',
                'value' => '$data->activ=="1" ? CHtml::image("/images/accept.png",Yii::t("content","Ativo")):CHtml::image("/images/cancel.png",Yii::t("content","Desactivado"))',
            ),
		/*
		'country',
		'district',
		'local',
		'category_id',
		'activ',
		'user_id',
		'date_add',
		'date_expire',
		'amount',
		'img1',
		'img2',
		'img3',
		'img4',
		'img5',
		*/
		array(
                'class' => 'CButtonColumn',
                'template' => '{update}{delete}',
                'buttons' => array(
                    'delete' => array(
                        'url' => 'Yii::app()->createUrl("realEstate/delete", array("id"=>$data->id))',
                        'imageUrl' => '/images/delete.png'
                    ),
                    'update' => array(
                        'url' => 'Yii::app()->createUrl("realEstate/update", array("id"=>$data->id))',
                        'submit' => 'post',
                        'imageUrl' => '/images/page_white_edit.png',
                        //'options' => array('class'=>'updateFila')
                        ),
                ),
            ),
	),
)); ?>
<script>
    
        $('#real-estate-grid').append('<br><a href="<?php echo Yii::app()->createUrl("realEstate/create") ?>" class="btn btn-success"><?php echo Yii::t("content", 'Adicionar') ?></a>');
   

</script>